home *** CD-ROM | disk | FTP | other *** search
- Path: news.umbc.edu!not-for-mail
- From: schlein@umbc.edu (Jonas J. Schlein)
- Newsgroups: comp.lang.c
- Subject: Re: Nedd help!!! <depth of recursion>
- Date: 7 Mar 1996 18:33:41 -0500
- Organization: University of Maryland Baltimore County
- Message-ID: <4hnrol$5ts@umbc9.umbc.edu>
- References: <JSA.96Feb16135027@organon.com> <4hl082INNc7d@keats.ugrad.cs.ubc.ca> <JSA.96Mar7145352@organon.com> <Pine.SUN.3.91.960307161803.17639A-100000@thomas.helios.nd.edu>
- NNTP-Posting-Host: umbc9.umbc.edu
- NNTP-Posting-User: schlein
-
- Ron Fodor <rfodor@thomas.helios.nd.edu> wrote:
- |> Anybody,
- |> I need help writing a program. The program is the Ackermann's
- |> function. It is defined like this...
- |>
- |> Ack(m,n) = {n+1 if m=0
- |> Ack(m-1,n) if n=0
- |> Ack(m-1,Ack(m,n-1) }
- |>
- |> My problem is computing the depth of recursion of the procedure <Ack(m,n)>.
- |> Any algorithm for finding it would be GREATLY appreciated.
- |> Thanks...
-
- Well I highly suspect this is a homework assignment since you are
- posting from a *.edu site. However, I will give you this hint...Add
- a global variable to your program called 'depth' and increment it everytime
- Ack() is called.
- --
- "If it wasn't for C, we would be using BASI, PASAL, and OBOL."
-
- Jonas J. Schlein (schlein@gl.umbc.edu)
-